var e = getApp();

Page({
    data: {
        upgradeStatus: "upgradeing",
        codeKey: null,
        codeMid: null
    },
    onLoad: function(t) {
        var a = this, s = null, n = null;
        if (t.scene) {
            var i = this.sceneDecode(t.scene);
            s = i.key, n = i.mid;
        } else s = t.key, n = scene.mid;
        e._setMid(n), wx.setNavigationBarTitle({
            title: "升级结果"
        }), this.setData({
            codeKey: s
        }, function() {
            a.upgradeLevel();
        });
    },
    sceneDecode: function(e) {
        var t = (e = decodeURIComponent(e)).split(","), a = {};
        return t.forEach(function(e, t) {
            var s = e.split("=")[0], n = e.split("=")[1];
            a[s] = n;
        }), a;
    },
    upgradeLevel: function() {
        var t = this, a = e.getNetAddresss("plugin.upgrade-code.Frontend.controllers.code.handle");
        e._getNetWork({
            url: a,
            data: {
                key: this.data.codeKey
            },
            success: function(e) {
                var a = e.data;
                e.msg;
                1 == a.result ? t.setData({
                    upgradeStatus: "success"
                }) : (wx.showToast({
                    title: a.msg,
                    icon: "none",
                    duration: 1500,
                    mask: !1
                }), t.setData({
                    upgradeStatus: "fail"
                })), setTimeout(function() {
                    wx.redirectTo({
                        url: "/packageG/member_v2/member_v2"
                    });
                }, 1e3);
            }
        });
    }
});